import demo1.Dog;

import java.util.SplittableRandom;

/*
public class Test {


    public static void main(String[] args) {
        //继承与多态
        //继承的思想
        //所谓继承在生活中有继承衣钵，继承遗产的说法，
        // java中引入了继承的思想，继承是类与类之前的关系，一个类继承另一个类的成员与方法
        //被继承的类称为父类 /基类 / 超类
        //继承的类成为 子类/派生类
        //子类可以使用父类的成员变量与方法，也可以定义自己的成员变量与方法！
        Dog dog1 = new Dog();
        dog1.age  = 10;
        dog1.func1();
        dog1.shout();

    }
}

class Animal{
    String name = "小黑";
    int age ;
    public void shout(){
        System.out.println("动物发出叫声！");
    }



}
class Dog  extends Animal {
    String name = "旺财";
    String sex ;

    public void eat(){
        System.out.println("狗在吃骨头！");
    }
    public void func1(){
        System.out.println("这只狗的名字叫" +super.name);

    }
    public void shout(){
       super.shout();
    }



}
*/
/*
public class Test {
    public static void main(String[] args) {
        Cat cat  = new Cat("母");
    }
}

class Animal{
    {
        System.out.println("调用了父类的构造代码块");


    }
    static {
        System.out.println("调用了父类的静态代码块");

    }

    String name;
    int age;
    public Animal(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("调用了父类的构造方法");
  }
 public void shout(){
        System.out.println("动物发出吼叫声！");
    }
}
     final   class  Cat extends  Animal{
    String sex;
     public  Cat(String sex){
         super("阿黄",10);
         this.sex = sex;
         System.out.println("调用了子类的构造方法");
     }
     static {
         System.out.println("调用了子类的静态代码块");


     }
    {
        System.out.println("调用了子类的构造代码块");
    }

}
class Mouse extends Cat{


    public Mouse(String sex) {
        super(sex);
    }
}
*/
   /*class Animal{
    String name;

       public   void   shout(){
        System.out.println("动物发出吼声");
    }
}
class Cat extends Animal{
    public void shout(String name){
        System.out.println( name+"发出吼叫");
        super.shout();
    }

}
public class Test {
    public static void main(String[] args) {
        Cat cat1 = new Cat();

        cat1.shout("猫");

    }
}*/
/*
public class Test {
    public static void main(String[] args) {

    }
}
class Car{
    Chelun chelun1; //前面我们讲过，类相当于一个自定义类型，自然可以作为一个成员变量！
    Wheel wheel  ;


}
class Chelun{
    int size;
    String  type;

}
class Wheel{
    int size;
    String type;

}
*/
public class Test {
    public static void main(String[] args) {
        Animal animal = new Cat();
        Cat cat1 =new Cat();
        Test test = new Test();
   //     test.shout(cat1);
    }
    public   static Cat func1(){
          Cat cat2 = new Cat();
          return cat2;
    }
   Animal animal3 =  func1();



}
class Animal{
    String name;
    int age;


}
class Cat extends Animal{
    String name;
    int age;
}

































